package com.matinzac.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.security.cert.X509Certificate;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * <p>Description: 封装读取微信支付配置信息的配置类</p>
 *
 * @author MtinZac
 * create on 2021/11/26 上午10:30
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@Component
@PropertySource("classpath:/wxpay_v3.properties")
@ConfigurationProperties(prefix = "v3")
public class WxPayConfig {
    /**
     * 小程序ID
     */
    private String appId;
    /**
     * client_key 路径
     */
    private String keyPath;

    /**
     * cert 路径
     */
    private String certPath;
    /**
     * 商户ID
     */
    private String mchId;
    /**
     * V3 key秘钥
     */
    private String v3Key;
    /**
     * API证书序列号
     */
    private String mchSerialNo;
    /**
     * 下单通知路径
     */
    private String notifyOrderUrl;
    /**
     * 通知回调路径
     */
    private String notifyRefoundUrl;
    /**
     * 支付成功返回路径
     */
    private String returnUrl;

    /**
     * 开发者秘钥
     */
    private String secret;


    /**
     * // 定义全局容器 保存微信平台证书公钥
     */
    public Map<String, X509Certificate> certificateMap = new ConcurrentHashMap<>();

}
